home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / MAG08.ZIP / FANGLORE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-22  |  3.7 KB  |  90 lines

  1. { ************************************************************************** }
  2. { *                                                                        * }
  3. { *                                FANGLORE                                * }
  4. { *                                                                        * }
  5. { *                             BY SPELLCASTER                             * }
  6. { *                                                                        * }
  7. { *                              VERSION 0.10                              * }
  8. { *                                                                        * }
  9. { *                            DATE : 20-4-1996                            * }
  10. { *                                                                        * }
  11. { *                                                                        * }
  12. { *  Developed of 'The Mag', Issue 8 for the 'Designing a Text Adventure'  * }
  13. { *  series of articles...                                                 * }
  14. { *                                                                        * }
  15. { ************************************************************************** }
  16.  
  17.  
  18. Program FangLore;
  19.  
  20. { ************************************************************************** }
  21. { ************************** Unit definition ******************************* }
  22. { ************************************************************************** }
  23.  
  24. Uses Crt;    { Use CRT for cute text procedures :) }
  25.  
  26. { ************************************************************************** }
  27. { ************************* Constant definition **************************** }
  28. { ************************************************************************** }
  29.  
  30. Const NumberRooms=2;   { Number of rooms in the game }
  31.  
  32. { ************************************************************************** }
  33. { *************************** Type definition ****************************** }
  34. { ************************************************************************** }
  35.  
  36. Type RoomType=Record
  37.                     Desc:Array[1..10] of String[79];  { Description }
  38.                     North,South,East,West:Byte;       { Exits }
  39.               End;
  40.  
  41. { ************************************************************************** }
  42. { ************************* Variable definition **************************** }
  43. { ************************************************************************** }
  44.  
  45. Var Rooms:Array[1..NumberRooms] of RoomType;   { Room data }
  46.  
  47. { ************************************************************************** }
  48. { ************************ Procedure definition **************************** }
  49. { ************************************************************************** }
  50.  
  51. Procedure ReadRoomData;     { Read from the disk the room data }
  52. Var F:Text;
  53.     A,B:Byte;
  54.     Flag:Boolean;
  55. Begin
  56.      { Prepares the text file for accessing }
  57.      Assign(F,'Room.Dat');
  58.      Reset(F);
  59.      { For every room in the game }
  60.      For A:=1 To NumberRooms Do
  61.      Begin
  62.           { Clear the room's description }
  63.           For B:=1 To 10 Do Rooms[A].Desc[B]:='';
  64.           { Read the description of the room }
  65.           Flag:=True;
  66.           B:=1;
  67.           While Flag Do
  68.           Begin
  69.                Readln(F,Rooms[A].Desc[B]);
  70.                If (B=10) Or (Rooms[A].Desc[B]='*') Then Flag:=False;
  71.                Inc(B);
  72.           End;
  73.           { Read exit data }
  74.           Readln(F,Rooms[A].North);
  75.           Readln(F,Rooms[A].South);
  76.           Readln(F,Rooms[A].East);
  77.           Readln(F,Rooms[A].West);
  78.      End;
  79.      Close(F);
  80. End;
  81.  
  82. Procedure Init;      { Initializes game data }
  83. Begin
  84.      ReadRoomData;
  85. End;
  86.  
  87. Begin
  88.      Init;
  89. End.
  90.